package com.obixlabs.security.credentialsstore.server.dao.ldapimpl.config;

import java.io.Serializable;

public class LDAPConnectionInfo implements Serializable 
{
	private static final long serialVersionUID = -6741577025638620915L;
	
	private String providerURL;
	private String authenticationType;	
	
	private LDAPConnectionInfo(){}
	
	public LDAPConnectionInfo(	String providerURL,
								String authenticationType)
	{
		this();
		setProviderURL(providerURL);
		setAuthenticationType(authenticationType);
	}	

	public void setProviderURL(String providerURL)
	{this.providerURL = providerURL;}
	public String getProviderURL(){return providerURL;}

	public void setAuthenticationType(String authenticationType)
	{this.authenticationType = authenticationType;}
	public String getAuthenticationType() {return authenticationType;}

	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((authenticationType == null) ? 0 : authenticationType
						.hashCode());
		result = prime * result
				+ ((providerURL == null) ? 0 : providerURL.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj)
	{
		if (this == obj) return true;
		if (obj == null) return false;
		if (getClass() != obj.getClass()) return false;
		LDAPConnectionInfo other = (LDAPConnectionInfo) obj;
		if (authenticationType == null)
		{
			if (other.authenticationType != null) return false;
		}
		else if (!authenticationType.equals(other.authenticationType))
			return false;
		if (providerURL == null)
		{
			if (other.providerURL != null) return false;
		}
		else if (!providerURL.equals(other.providerURL)) return false;
		return true;
	}

	@Override
	public String toString()
	{
		return "providerURL=\"" + providerURL + "\", authenticationType=\"" 
				+ authenticationType + "\"";
	}

	
}
